package com.wangdao.wechatmall.controller.admin;

import com.wangdao.wechatmall.bean.bo.admin.*;
import com.wangdao.wechatmall.bean.pojo.*;
import com.wangdao.wechatmall.bean.vo.admin.AddressLIstVO;
import com.wangdao.wechatmall.bean.vo.admin.BaseDataVO;
import com.wangdao.wechatmall.bean.vo.admin.BaseRespVo;
import com.wangdao.wechatmall.service.admin.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 用户管理模块
 *
 * @author ZhangXiao on 2021/7/8
 */
@RequestMapping("admin")
@RestController
public class AdminController {

    @Autowired
    AdminService adminService;

    @Autowired
    UserService userService;

    @Autowired
    CollectService collectService;

    @Autowired
    AddressService addressService;

    @Autowired
    HistoryService historyService;

    @Autowired
    FeedbackListService feedbackListService;

    @Autowired
    FootprintListSrevice footprintListSrevice;

    //会员管理单元
    @RequestMapping("user/list")
    public BaseRespVo userList(UserReqBO userReqBO) {
        BaseDataVO<User> baseDataVO = userService.queryUsers(userReqBO);
        return BaseRespVo.ok(baseDataVO);
    }

    //收货地址单元
    @RequestMapping("address/list")
    public BaseRespVo addressList(AddressListBO addressListBO) {
        BaseDataVO<AddressLIstVO> addressLIstVO = addressService.queryAddress(addressListBO);
        return BaseRespVo.ok(addressLIstVO);
    }

    //会员收藏单元
    @RequestMapping("collect/list")
    public BaseRespVo collectList(CollectListBO collectListBO) {
        BaseDataVO<Collect> baseDataVO = collectService.queryCollect(collectListBO);
        return BaseRespVo.ok(baseDataVO);
    }

    //会员足迹单元
    @RequestMapping("footprint/list")
    public BaseRespVo footprintList(FootprintListBO footprintListBO) {
        BaseDataVO<Footprint> footprintBaseDataVO = footprintListSrevice.queryFootprintList(footprintListBO);
        return BaseRespVo.ok(footprintBaseDataVO);

    }

    //搜索历史单元
    @RequestMapping("history/list")
    public BaseRespVo historyList(HistoryListBO historyListBO) {
        BaseDataVO<SearchHistory> searchHistoryBaseDataVO = historyService.querySearchHistory(historyListBO);
        return BaseRespVo.ok(searchHistoryBaseDataVO);

    }

    //意见反馈单元
    @RequestMapping("feedback/list")
    public BaseRespVo feedbackList(FeedbackListBO feedbackListBO) {
        BaseDataVO<Feedback> feedbackBaseDataVO = feedbackListService.queryFeedbackList(feedbackListBO);
        return BaseRespVo.ok(feedbackBaseDataVO);

    }

}
